#pragma once
#include <osgGA/KeySwitchMatrixManipulator>
#include <osgGA/MultiTouchTrackballManipulator>// for touchscreen devices
#include <osgGA/AnimationPathManipulator>// reads an animation path from a file and plays it back
#include <osgGA/TrackballManipulator>
#include <osgGA/FlightManipulator>
#include <osgGA/DriveManipulator>
#include <osgGA/TerrainManipulator>
#include <osgGA/OrbitManipulator>
#include <osgGA/FirstPersonManipulator>
#include <osgGA/SphericalManipulator>

class OKeySwitchManipulator : public osgGA::KeySwitchMatrixManipulator {
public:
    OKeySwitchManipulator(osg::Camera* camera = nullptr) {
        if (camera) {
            osg::Vec3 eye, center, up;
            camera->getViewMatrixAsLookAt(eye, center, up);
            this->setHomePosition(eye, center, up);
        }
        this->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() );
        this->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() );
        this->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
        this->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
        this->addMatrixManipulator( '5', "Orbit", new osgGA::OrbitManipulator() );
        this->addMatrixManipulator( '6', "FirstPerson", new osgGA::FirstPersonManipulator() );
        this->addMatrixManipulator( '7', "Spherical", new osgGA::SphericalManipulator() );
    }
};